<!-- 绑定事件 触发方法 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
  
</head>
<body>
    <!-- view 层 模板 -->
    <div id="app">
        <button v-on:click="sayHi">click me</button>
    </div>

    <!-- 导入vue.js -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
    <script>
        var vm = new Vue({
            // 绑定dom
            el: "#app",
            data: {
                message: "ikun"
            },
            methods: { // 方法必须定义在 vue 的 method 对象中, v-on: 事件
                sayHi: function () {
                    alert(this.message);
                }
            }
        });

    </script>
</body>
</html>